#include <bits/stdc++.h>
using namespace std;

int main() {
    char x;
    int v, t;
    cin >> x >> v >> t;
    int failtime = t-3;
    int resmax = 0, resmin = 0;
    resmax += v; 
    resmin += v;
    int failtimemax, failtimemin;
    if(x == 'a') {
        failtime -= v;
        failtimemax = failtime;
        failtimemin = failtime;
        if(failtimemin % 3 == 0) {
            resmin += failtimemin / 3;
        }else {
            while(failtimemin % 3 != 0) {
                failtimemin -= 2;
                resmin += 1;
            }
            resmin += failtimemin / 3;
        }
        if(failtimemax % 2 == 0) {
            resmax += failtimemax / 2;
        }else {
            while(failtimemax % 2 != 0) {
                failtimemax -= 3;
                resmax += 1;
            }
            resmax += failtimemax / 2;
        }
    }else if(x == 'b') {
        failtime -= v*2;
        failtimemax = failtime;
        failtimemin = failtime;
        if(failtimemin % 3 == 0) {
            resmin += failtimemin / 3;
        }else {
            while(failtimemin % 3 != 0) {
                failtimemin -= 1;
                resmin += 1;
            }
            resmin += failtimemin / 3;
        }
        resmax += failtimemax;
    }else {
        failtime -= v*3;
        failtimemax = failtime;
        failtimemin = failtime;
        if(failtimemin % 2 == 0) {
            resmin += failtimemin / 2;
        }else {
            while(failtimemin % 2 != 0) {
                failtimemin -= 1;
                resmin += 1;
            }
            resmin += failtimemin / 2;
        }
        resmax += failtimemax;
    }
    cout << resmax << " " << resmin;
}